#include "Common.hpp"
#include "ShareMemory.hpp"
#include "Fifo.hpp"

int main()
{

    share_mem.CreateShm();
    share_mem.AttachShm();
    fifo.FifoInit();
    fifo.OpenForRead();

    void *addr = share_mem.GetAddr();
    // char buffer[gsize];
    struct Data *image = (struct Data *)addr;

    while (true)
    {
        // memcpy(buffer,addr,sizeof(buffer));
        // std::cout<<"server:"<<buffer<<std::endl;
        fifo.Wait();
        printf("status: %s\n", image->status);
        printf("lasttime: %s\n", image->lasttime);
        printf("image: %s\n", image->image);
        strcpy(image->status,"过期");

        sleep(3);
    }

    fifo.FifoDelete();
    share_mem.DetachShm();
    share_mem.DeleteShm();

    return 0;
}